package day04;

import java.util.Random;
import java.util.Scanner;

/**
 * @author yzg
 * @desc TODO
 * @date 2025/4/11
 */
public class ClassScoreAnalyze {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        Random random = new Random();

        System.out.println("请输入班级人数:");
        int classSize = sc.nextInt();

        int[] scores = new int[classSize];

        for (int i = 0; i < scores.length; i++) {
            scores[i] = random.nextInt(101);
        }

        int failCount = 0;
        int sum = 0;

        for (int score : scores) {
            if (score < 60) {
                failCount++;
            }
            sum += score;
        }

        double average = (double) sum / classSize;

        System.out.println("不及格人数:" + failCount);
        System.out.println("班级平均分:" + (int) average);
    }
}
